package factory;

/**
 * 任务类
 * 封装农机设备需要执行的任务信息
 */
public class Task {
    private String name;
    private String description;
    private String fieldId;
    private double priority;
    private boolean completed;

    public Task(String name, String description) {
        this.name = name;
        this.description = description;
        this.fieldId = "FieldA"; // 默认农田
        this.priority = 5.0; // 默认优先级
        this.completed = false;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public String getFieldId() {
        return fieldId;
    }

    public void setFieldId(String fieldId) {
        this.fieldId = fieldId;
    }

    public double getPriority() {
        return priority;
    }

    public void setPriority(double priority) {
        this.priority = priority;
    }

    public boolean isCompleted() {
        return completed;
    }

    public void markAsCompleted() {
        this.completed = true;
    }

    @Override
    public String toString() {
        return "任务: " + name +
                ", 描述: " + description +
                ", 农田: " + fieldId +
                ", 优先级: " + priority +
                ", 状态: " + (completed ? "已完成" : "进行中");
    }
}